package com.suman.bbcticker.utils;

import java.net.URL;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.util.Log;
import android.widget.RemoteViews;

import com.suman.bbcticker.ApplicationStateObjectsHolder;
import com.suman.bbcticker.R;
import com.suman.bbcticker.weather.GoogleWeatherHandler;
import com.suman.bbcticker.weather.WeatherSet;

public class CleanUpUtils {
	
	private static final String TAG = "CleanUpUtils";
	


	/**
	 * Removes locationlistener instance from statis hashmap when the widget instance gets deleted	 
	 * @param context
	 * @param appWidgetId
	 */

	public void cleanupLocationListenerForWeatherService(Context context, int appWidgetId) {
		LocationListener locationListener = ApplicationStateObjectsHolder.locationListenerMap.get(appWidgetId);
		if(locationListener!=null){
			LocationManager mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
			mLocationManager.removeUpdates(locationListener);
		}
		ApplicationStateObjectsHolder.locationListenerMap.remove(appWidgetId);
	}
	
	
}
